<%@ page contentType="text/html;charset=UTF-8" language="java"
	isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="shortcut icon" href="img/favicon.ico">
<META NAME="Description" CONTENT="Buscador automóveis RS Revendas carros">
<link type="text/css" rel="stylesheet" href="css/screen.css">

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AcheMeuCarro.com.br - Resultados da busca</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<meta name="google-site-verification" content="qhrbhHgJcPMh-iibZKUL3xSRVeOPC7xXrXkXkY5wQ9I" />
</head>
<c:set var="count" value="0" />
<body>
<jsp:include page="menu.jsp"/>

<c:if test="${fn:length(sessionScope[pageContext.session.id]) == 0}">
 	<script>location.href = "index.jsp?notFound=1";</script>
</c:if>


<div class="wrap" align="center">
  <c:if test="${sessionScope[pageContext.session.id] != null && fn:length(sessionScope[pageContext.session.id]) > 0 }">
	<table>
		<tr>
			<th>MODELO</th>
			<th>ANO</th>
			<th>COR</th>
			<th>COMBUSTIVEL</th>
			<th>VALOR</th>
			<th>ORIGEM</th>
			<th></th>
		</tr>
		</c:if>
		<c:forEach var="car" items="${sessionScope[pageContext.session.id]}" varStatus="status">
			<c:choose>
				<c:when test="${count%2 == 0}">
					<tr class="even">
				</c:when>
				<c:otherwise>
					<tr class="doven">
				</c:otherwise>
			</c:choose>
					<td>${car.modelo}</td>
					<td>${car.anoModelo}</td>
					<td>${car.cor}</td>
					<td>${car.combustivel}</td>
					<td>${car.valor}</td>
					<td>${car.revenda.nome }</td>
					<td>
					   <a href="${car.url}" id="link" name="link" target="_blank" >
						<img name="view" alt="Ver no anunciante" title="Ver no anunciante" src="img/view.gif" > 
					   </a> 
					</td>
				</tr>
			<c:set var="count" value="${count+1}" />
		</c:forEach>
		<c:if test="${sessionScope.cars != null}">
	</table>
</c:if>
</div>
</body>
<script>
$(document).ready(function(){
    $("#link").live('click',function () {
      	count = $("a[name=link]").index(this);
    	var det = $("img[name=view]");
    	det.eq(count).attr("src","img/viewOff.gif"); 

    });         
})



</script>

</html>